package pagelib;

public class Plans extends Page {
	
	static final String allPlansTab="//LI[@id='allPlansTab']/A";		
	static final String individualPlansTab="//LI[@id='indivPlansTab']/A";
	static final String familyPlansTab = "//LI[@id='famPlansTab']/A";
	static final String businessPlansTab = "//LI[@id='busPlansTab']/A";
	
	static final String indPlan450Det = "//DIV[@id='individualPlans']/TABLE/TBODY/TR[1]/TD[1]/A";
	static final String indPlan450Price = "//DIV[@id='individualPlans']/TABLE/TBODY/TR[1]/TD[5]";
	static final String indPlan450AddToCart = "//DIV[@id='individualPlans']/TABLE/TBODY/TR[1]/TD[6]/A";
	
	static final String indPlan900Det = "//DIV[@id='individualPlans']/TABLE/TBODY/TR[2]/TD[1]/A";
	static final String indPlan900Price = "//DIV[@id='individualPlans']/TABLE/TBODY/TR[2]/TD[5]";
	static final String indPlan900AddToCart = "//DIV[@id='individualPlans']/TABLE/TBODY/TR[2]/TD[6]/A";
	
	static final String indPlanUnlimitedDet = "//DIV[@id='individualPlans']/TABLE/TBODY/TR[3]/TD[1]/A";
	static final String indPlanUnlimitedPrice = "//DIV[@id='individualPlans']/TABLE/TBODY/TR[3]/TD[5]";
	static final String indPlanUnlimitedAddToCart = "//DIV[@id='individualPlans']/TABLE/TBODY/TR[3]/TD[6]/A";
	
	static final String  skypeAction1 = "//DIV[@id='businessPlans']/DIV/DIV[3]/P[2]/SPAN/SPAN[2]/SPAN[2]/SPAN[2]/SPAN";
	static final String skypeAction2 ="//DIV[@id='businessPlans']/DIV/DIV[3]/P[4]/SPAN/SPAN[2]/SPAN[2]/SPAN[2]/SPAN";
	static final String phoneNumber1 = "//DIV[@id='businessPlans']/DIV/DIV[3]/P[2]/SPAN/SPAN[2]/SPAN[2]/SPAN[3]/SPAN";
	static final String phoneNumber2= "//DIV[@id='businessPlans']/DIV/DIV[3]/P[4]/SPAN/SPAN[2]/SPAN[2]/SPAN[3]/SPAN";
	static final String phone1 = "//DIV[@id='businessPlans']/DIV/DIV[3]/P[2]/SPAN/SPAN[2]/SPAN[2]/SPAN[4]";
	static final String phone2 = "//DIV[@id='businessPlans']/DIV/DIV[3]/P[4]/SPAN/SPAN[2]/SPAN[2]/SPAN[4]";
	static final String callBackString="//DIV[@id='businessPlans']/DIV/DIV[3]/P[3]/A";
	
	public String getMessage(String ID)
	{
		String msgString=null;
		msgString = getElementText("ID");
		return (msgString);
	}
	
	public void clickAddPlanToCart(String idLink)
	{
		super.clickAddToCart(idLink);
	}
	
	public String getPlanPrice(String phoneID)
	{
		return super.getPrice(phoneID);
	}
	
	public boolean checkTabExist()
	{
		boolean tabExist = true;

		tabExist = isElementVisible(allPlansTab);
		tabExist = isElementVisible(individualPlansTab);
		tabExist = isElementVisible(familyPlansTab);
		tabExist = isElementVisible(businessPlansTab);
		
		return (tabExist);
	}
	
	public boolean checkAllIndLinksExist()
	{
		boolean allLinksExist=true;
		
		allLinksExist = isElementVisible(indPlan450Det);
		allLinksExist = isElementVisible(indPlan450Price);
		allLinksExist = isElementVisible(indPlan450AddToCart);
		allLinksExist = isElementVisible(indPlan900Det);
		allLinksExist = isElementVisible(indPlan900Price);
		allLinksExist = isElementVisible(indPlan900AddToCart);
		allLinksExist = isElementVisible(indPlanUnlimitedDet);
		allLinksExist = isElementVisible(indPlanUnlimitedPrice);
		allLinksExist = isElementVisible(indPlanUnlimitedAddToCart);
		
		return allLinksExist;
	}
	
	public boolean checkAllBusinessLinksExist()
	{
		boolean allBusinessPlanLinksExist = true;
		
		allBusinessPlanLinksExist = isElementVisible(skypeAction1);
		allBusinessPlanLinksExist = isElementVisible(skypeAction2);
		allBusinessPlanLinksExist = isElementVisible(phoneNumber1);
		allBusinessPlanLinksExist = isElementVisible(phoneNumber2);
		allBusinessPlanLinksExist = isElementVisible(phone1);
		allBusinessPlanLinksExist = isElementVisible(phone2);
		allBusinessPlanLinksExist = isElementVisible(callBackString);
		
		return (allBusinessPlanLinksExist);
	}
	
	public void selectFamilyTab(String linkID)
	{
		super.clickVisibleLink(linkID);
	}
	
	public void selectIndividualTab(String linkID)
	{
		super.clickVisibleLink(linkID);
	}
	
	public void selectBusinessTab(String linkID)
	{
		super.clickVisibleLink(linkID);
	}
	
	
	
}
